import { getSession } from '@/utils/session'

let homeConfig = JSON.parse(getSession('homeConfig')) || []

function showSomething(code, value) {
  let data = homeConfig.filter((v) => v.code == code)
  return data.map((v) => v[value]).toString()
}
//模块是否显示
export function showModule(code) {
  let res = homeConfig.filter((v) => v.code == code)
  return res.length ? res[0].isShow == 0 : true
}
//显示模块名字
export function showModuleName(code) {
  return showSomething(code, 'name')
}
//显示模块英文名字
export function showModuleEnName(code) {
  return showSomething(code, 'field4')
}
//显示模块二级标题
export function showModuleSubTitle(code) {
  return showSomething(code, 'field1')
}
